﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using MP.Core.Library;

public partial class Admin_Deleted : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btn_Click(object sender, EventArgs e)
    {
        string users = txtUser.Text.Trim();
        MembershipUserCollection us = Membership.GetAllUsers();
        foreach (MembershipUser u in us)
        {
            if (u.UserName != users)
            {
                Membership.DeleteUser(u.UserName);
            }
        }

        string strSQL = "Delete From hrPosition Where UserId <> '" + users + "'";
        SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringOBS, CommandType.Text, strSQL);

        strSQL = "Delete From hrEmployee Where WindowsUser <> '" + users + "'";
        SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringOBS, CommandType.Text, strSQL);
    }
}
